<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('返现黑名单列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">商户编号：</label>
                                <input type="text" name="merno"/>
                            </li>
                            <li>
                                <label style="width: 100px;">商户名称：</label>
                                <input type="text" name="merName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">身份证号：</label>
                                <input type="text" name="idNumber"/>
                            </li>
                            <li>
                                <label style="width: 100px;">黑名单类型：</label>
                                <select name="blackType">
                                    <option value="">所有</option>
                                    <option value="1">身份证已注册</option>
                                    <option value="2">平台奖励已发放</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="1">启用</option>
                                    <option value="2">已移除</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px;">添加时间：</label>
                                <input type="text" name="start" placeholder="开始时间" readonly class="time-input"/>
                                <span>-</span>
                                <input type="text" name="end" placeholder="结束时间" readonly class="time-input"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add(600,1100)" shiro:hasPermission="returnBlack:returnBlack:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" id="edit" onclick="$.operate.edit('',400,800)" shiro:hasPermission="returnBlack:returnBlack:remove">
                    <i class="fa fa-remove"></i> 移除
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="riskControl:riskmerblack:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('returnBlack:returnBlack:edit')}]];
        var removeFlag = [[${@permission.hasPermi('returnBlack:returnBlack:remove')}]];
        var prefix = ctx + "returnBlack/returnBlack";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                detailUrl: prefix + "/detail/{id}",
                importUrl: prefix + "/importData",
                importTemplateUrl: prefix + "/export",
                modalName: "返现黑名单",
                firstLoad:false,
                clickToSelect:true,
                onClickRow(row){
                    if(row.status == 2){
                        $("#edit").removeAttrs("onclick")
                        $("#edit").attr("disabled","disabled")
                    }else{
                        $("#edit").attr("onclick","$.operate.edit('',400,800)")
                        $("#edit").removeAttrs("disabled")
                    }
                },
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '黑名单内容',
                    visible: false
                },
                {
                    field: 'idNumber',
                    title: '黑名单内容'
                },
                {
                    field: 'blackType',
                    title: '黑名单类型',
                    formatter:function (value, row, index) {
                        if (value == '1'){
                            return "<span style='color: green'>身份证已注册</span>";
                        } else if (value == '2'){
                            return "<span style='color: green'>平台奖励已发放</span>";
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'merno',
                    title: '商户编号'
                },
                {
                    field: 'merName',
                    title: '商户名称'
                },

                {
                    field: 'status',
                    title: '状态  ',
                    formatter:function (value, row, index) {
                        if (value == '1'){
                            return "<span style='color: blue'>启用</span>";
                        }else if (value == '2'){
                            return "<span style='color: red'>已移除</span>";
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'addNote',
                    title: '添加原因'
                },
                {
                    field: 'delNote',
                    title: '移除原因'
                },
                {
                    field: 'addMan',
                    title: '添加人'
                },
                {
                    field: 'addDate',
                    title: '添加时间'
                },
                {
                    field: 'delDate',
                    title: '移除时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt5 pt5" style="margin-left: 70%;margin-top: -25px;">
                     &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>
</body>
</html>